<template>
  <div class="kongbai">
   <div v-html="formData">
    
  </div>
  </div>
  
</template>

<script>

//api 
// import {
//  getInfo
// } from '@/api/moneyManagement'

export default {
  name: 'Login',
  components: {

  },
  data() {
   
    return {
      code: '',
      data: {},
      formData: '',
    }
  },
  watch: {
    
  },
  created() {
    this.GetRequest()
    // window.addEventListener('storage', this.afterQRScan)
    this.getInfo()
  },
  mounted() {
    
  },
  methods: {
    GetRequest() {
      var url = location.search; //获取url中"?"符后的字串  
      var theRequest = new Object();  
      if (url.indexOf("?") != -1) {  
          var str = url.substr(1);  
          var strs = str.split('=')
      }  
      this.code = strs[1]; 
    },
    //合利宝签章详情
    getInfo(){
      const code = this.code
      getInfo(code).then(res => {
        const {  result } = res
        this.data = result
        this.loadPost()
      })
      .finally(() => {
        this.loading = false
      })
    },
    loadPost(){
      // var _this=this;
      // var data = {
      //   email: this.data.email,
      //   phone: this.data.phone,
      //   legalPerson: this.data.legalPerson,
      //   legalPersonID: this.data.legalPersonID,
      //   address: this.data.address,
      //   signName: this.data.signName,
      //   merchantNo: this.data.merchantNo,
      //   callBackUrl: this.data.callBackUrl,
      //   sign: this.data.sign,
      //   body: this.data.body,
      //   interfaceName: this.data.interfaceName,
      // }
      console.log("data.",this.data)
      var html = '<form id="agreementForm" name="agreementForm" action='+ this.data.signUrl+' method="post">' ;
          html += '<input type="hidden" name="legalPersonID" value='+this.data.legalPersonID+'>'
          html += '<input type="hidden" name="signName" value='+this.data.signName+'>'
          html += '<input type="hidden" name="address" value='+this.data.address+'>'
          html += '<input type="hidden" name="callBackUrl" value='+this.data.callBackUrl+'>'
          html += '<input type="hidden" name="phone" value='+this.data.phone+'>'
          html += '<input type="hidden" name="legalPerson" value='+this.data.legalPerson+'>'
          html += '<input type="hidden" name="sign" value='+this.data.sign+'>'
          html += '<input type="hidden" name="interfaceName" value='+this.data.interfaceName+'>'
          html += '<input type="hidden" name="body" value='+this.data.body+'>'
          html += '<input type="hidden" name="email" value='+this.data.email+'>'
          html += '<input type="hidden" name="merchantNo" value='+this.data.merchantNo+'>'
          html += '<input class="submitBtn" style="border: none;background: #46a6ff;padding: 20px 40px;color: #fff;font-size: 16px" type="submit" value="点击获取电子签章">'
          html += '</form>'
          this.formData = html
    },
  }
}
</script>
<style lang="scss" scoped>
.kongbai{
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  
}
.submitBtn{
    border: none !important;
    background: #46a6ff !important;
    padding: 20px 40px !important;
    color: #fff !important;
    font-size: 16px !important;
  }
  
</style>
